#include "junix.h"

#define BIT(x) (unsigned)1<<(x) 

# define GEN	(BIT (26) | BIT (23) | BIT (22) | BIT (16) | BIT (12) \
                          | BIT (11) | BIT (10) | BIT (8) | BIT (7) | BIT (5) \
			  | BIT (4) | BIT (2) | BIT (1) | BIT (0))
static unsigned r[8];

static void fill_r (void)
{
  r[0] = GEN;
}

static unsigned jremainder (int m)
{
  unsigned rem = 0;
  int i;

  for (i = 0; i < 8; i++)
    if (BIT (i) & m)
      rem ^= r[i];

  return rem & 0xFFFFFFFF;	/* Make it run on 64-bit machine.  */
}

int main(int argc, char **argv)
{
	int i;
	for(i=0;i<32;++i)
		printf("%#010X\n",BIT(i));
	
	printf("%X\n",GEN);
	printf("%d\n",jremainder(20));
	return 0;
}

